function norm_prob=fld2prob(fld_vec)

% This function  normalize  the probability output of the FLD classifier.

% Function Inputs:
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
% fld_vec - an array of probability output, in size of amount of regions.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

% Function Outputs:
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
%  norm_prob - normalize probability array.
%-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

M=max(fld_vec);
m=min(min(fld_vec),0);
norm_prob=zeros(size(fld_vec));
class1=(fld_vec>=0);
class2=(fld_vec<0);
norm_prob(class1)=fld_vec(class1)/M;
norm_prob(class2)=fld_vec(class2)/m;